package com.pet.mapper;

import com.pet.entity.PetInformation;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface PetInformationMapper {

    /**
     * 添加宠物信息
     * @param petInformation
     */
    void insertPetInformation(PetInformation petInformation);

    /**
     * 查询所有宠物信息
     * @return
     */
    @Select("select * from pet_manage_system.pet_information")
    List<PetInformation> selectPetInformationAll();

    /**
     * 修改宠物信息
     * @param e
     */
    void updatePetInformation(PetInformation e);

    /**
     * 根据宠物id查询宠物信息
     */
    @Select("select * from pet_manage_system.pet_information where id = #{petId}")
    PetInformation selectPetInfoById(Integer petId);

    /**
     * 根据用户id获取宠物idList
     * @param currentId
     * @return
     */
    @Select("select id from pet_manage_system.pet_information where create_user = #{currentId}")
    List<Integer> selectPetIdListByUserId(Long currentId);

    /**
     * 删除宠物信息
     * @param id
     */
    @Delete("delete from pet_manage_system.pet_information where id=#{id}")
    void deletePetInformation(Integer id);

    /**
     * 查询个人宠物信息
     * @param currentId
     * @return
     */
    @Select("select * from pet_manage_system.pet_information where create_user = #{currentId}")
    List<PetInformation> selectPetSelfInformation(Long currentId);

    /**
     * 根据用户id删除用户宠物信息
     * @param userId
     */
    @Delete("delete from pet_manage_system.pet_information where create_user = #{userId}")
    void deletePetInformationByUserId(Integer userId);
}
